home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-22 | 3.8 KB | 148 lines | [TEXT/CWIE] |
- // Release Version: $ ODF 2 $
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
-
- //================================================================================
- #ifndef PART_H
- #include "Part.h"
- #endif
-
- #ifndef FRAME_H
- #include "Frame.h"
- #endif
-
- #ifndef DEFINES_K
- #include "Defines.k"
- #endif
-
- #ifndef BINDING_K
- #include "Binding.k"
- #endif
-
- // ----- Framework Includes -----
- #ifndef FWABOUT_H
- #include "FWAbout.h" //::FW_About()
- #endif
-
- #ifndef FWITERS_H
- #include "FWIters.h" // FW_CPresentationFrameIterator, FW_CFrameFacetIterator
- #endif
-
- #ifndef FWIDLE_H
- #include "FWIdle.h" // FW_CIdler
- #endif
-
- #ifndef SLMIXOS_H
- #include "SLMixOS.h" // FW_GetMainScreenBounds
- #endif
-
- //==============================================================================
- #ifdef FW_BUILD_MAC
- #pragma segment Idling
- #endif
-
- FW_DEFINE_AUTO(CIdlingPart)
- //==============================================================================
- CIdlingPart::CIdlingPart(ODPart* odPart)
- : FW_CPart(odPart, FW_gInstance, kPartInfoID),
- fIdlingActive(TRUE),
- fIdler(NULL),
- fPresentation(NULL)
- {
- FW_END_CONSTRUCTOR
- }
-
- //--------------------------------------------------------------------------------
- CIdlingPart::~CIdlingPart()
- {
- FW_START_DESTRUCTOR
- delete fIdler;
- }
-
- //--------------------------------------------------------------------------------
- void
- CIdlingPart::Initialize(Environment* ev, ODStorageUnit* storageUnit, FW_Boolean fromStorage) // Override
- {
- FW_CPart::Initialize(ev, storageUnit, fromStorage);
- FW_CSelection* selection = NULL;
- const ODType kMainPresentation = "Apple:Presentation:Idling";
- fPresentation = this->RegisterPresentation(ev, kMainPresentation, TRUE, selection);
- const ODIdleFrequency kIdleFreq = 10; // ticks
- fIdler = FW_NEW(FW_CIdler, (this, kIdleFreq));
- fIdler->RegisterIdle(ev);
- }
-
- //--------------------------------------------------------------------------------
- FW_CFrame*
- CIdlingPart::NewFrame(Environment* ev, ODFrame* odFrame,
- FW_CPresentation* presentation, FW_Boolean fromStorage) // Override
- {
- FW_UNUSED(fromStorage);
- return FW_NEW(CIdlingFrame, (ev, odFrame, presentation, this));
- }
-
- //--------------------------------------------------------------------------------
- FW_CContent*
- CIdlingPart::NewPartContent(Environment* ev)
- {
- FW_UNUSED(ev);
- return NULL;
- }
-
- //----------------------------------------------------------------------------------------
- FW_CWindow*
- CIdlingPart::NewDocumentWindow(Environment* ev)
- {
- FW_CRect screenBounds;
- ::FW_GetMainScreenBounds(screenBounds);
- screenBounds.Inset(FW_IntToFixed(3), FW_IntToFixed(3));
-
- return new FW_CWindow(ev,
- this,
- FW_CPart::fgViewAsFrameToken,
- fPresentation,
- FW_CPoint(FW_IntToFixed(72), FW_IntToFixed(72)),
- screenBounds.TopLeft(),
- FW_kDocumentWindow);
- }
-
- //--------------------------------------------------------------------------------
- FW_Handled
- CIdlingPart::DoIdle(Environment* ev, const FW_CNullEvent& theNullEvent) // Override
- {
- FW_UNUSED(theNullEvent);
- FW_CPresentationFrameIterator iter(ev, fPresentation);
- for (CIdlingFrame* frame = (CIdlingFrame*)iter.First(ev);
- iter.IsNotComplete(ev);
- frame = (CIdlingFrame*)iter.Next(ev))
- {
- FW_CFrameFacetIterator facetIter(ev, frame);
- for (ODFacet* facet = facetIter.First(ev);
- facetIter.IsNotComplete(ev);
- facet = facetIter.Next(ev))
- {
- frame->MyToggleColor();
- frame->Draw(ev, facet, NULL);
- } // for facets
- } // for frames
- return true;
- }
-
- //--------------------------------------------------------------------------------
- void
- CIdlingPart::MyToggleIdling(Environment* ev)
- {
- fIdlingActive = ! fIdlingActive;
- fIdler->RegisterIdle(ev, fIdlingActive);
- }
-
- //--------------------------------------------------------------------------------
- FW_Handled
- CIdlingPart::DoAbout(Environment* ev) // Override
- {
- ::FW_About(ev, this, kAbout);
-
- return FW_kHandled;
- }
-
-
-